package pool;

import java.util.concurrent.ThreadPoolExecutor;

public class MessageRunnable implements Runnable {

	private String groupId;
	
	private ThreadPoolExecutor executor;
	
	public MessageRunnable(String groupId, ThreadPoolExecutor executor){
		this.groupId = groupId;
		this.executor = executor;
	}
	

	@Override
	public void run() {
		
		for(int i = 1; i <= 20; i++){
			GroupTask task = new GroupTask("groupId" + groupId, "msgId" + i);				
			executor.execute(task);
			
			try {
				Thread.sleep(2);
			} catch (InterruptedException e) {
			}
		}
	}
	
}
